package org.vectrics.user;

import java.util.Comparator;

public class UserPrivilegeTypeNameComparator implements Comparator {

	public UserPrivilegeTypeNameComparator() {
		super();
	}

	public int compare(Object o1, Object o2) {
		UserPrivilegeType userPrivilegeType1 = (UserPrivilegeType)o1;
		UserPrivilegeType userPrivilegeType2 = (UserPrivilegeType)o2;
		int result = userPrivilegeType1.getUserPrivilegeTypeGroup().getCode().compareTo(userPrivilegeType2.getUserPrivilegeTypeGroup().getCode());
		if (result == 0)
		   result = userPrivilegeType1.getName().compareTo(userPrivilegeType2.getName());
		return(result);
	}

}
